home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / oleo-1_4.lha / oleo-1.4 / display.h < prev    next >
C/C++ Source or Header  |  1993-01-16  |  4KB  |  116 lines

  1. #ifndef DISPLAYH
  2. #define DISPLAYH
  3.  
  4. /*    Copyright (C) 1992, 1993 Free Software Foundation, Inc.
  5.  
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with this software; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19. /*  t. lord    Sat Oct  3 16:08:21 1992    */
  20.  
  21. #include "global.h"
  22. #include "font.h"
  23. #include "cell.h"
  24. #include "ir.h"
  25.  
  26. union cell_numeric
  27. {
  28.   int integer;
  29.   double dbl;
  30. };
  31.  
  32. struct cell_display
  33. {
  34.   CELLREF r, c;
  35.   int cell_type;
  36.   int justification;
  37.   struct font_memo *font;
  38.  
  39.   char *unclipped;
  40.   struct xx_sIntRectangle goal;
  41.  
  42.   char *clipped;        /* Box of clipped string, if known. */
  43.   struct xx_sIntRectangle clip;
  44.   union cell_numeric numeric;    /* Value from which to compute clipped str. */
  45.  
  46.  
  47.   struct xx_sIntRectangle layout;    /* Space available under current layout. */
  48.  
  49.   struct cell_display *used_by;
  50.   struct cell_display *was_used_by;
  51.   struct cell_display *next_damaged;
  52. };
  53.  
  54. struct display;
  55. /* This should set the w_goal and h_goal fields of the cell_display. */
  56. #ifdef __STDC__
  57. typedef void (*cell_display_metric) (struct cell_display *,
  58.                      struct display *);
  59. #else
  60. typedef void (*cell_display_metric) ();
  61. #endif
  62.  
  63. struct display
  64. {
  65.   struct rng range;
  66.   int *widths;
  67.   int *heights;
  68.   int *rowy;
  69.   int *colx;
  70.   void *vdata;
  71.   cell_display_metric metric;
  72.   struct cell_display *cells;
  73.   struct cell_display *damaged;    /* This is a list, terminated by a pointer */
  74.                     /* to this structure rather than 0, */
  75.                     /* following the next_damage chain. */
  76. };
  77.  
  78. #ifdef __STDC__
  79. extern void free_display (struct display *);
  80. extern void build_display (struct display *, struct rng *,
  81.                cell_display_metric, void *);
  82. extern void build_unscaled_display (struct display *, struct rng *,
  83.                     cell_display_metric, void *);
  84. extern void display_test_cmd (struct rng *);
  85. extern struct cell_display *cell_display_of (struct display *dpy,
  86.                          CELLREF r, CELLREF c);
  87. extern void display_range (struct rng *, struct display *dpy,
  88.                int x, int y, int w, int h);
  89. extern void record_display_damage (struct display *,
  90.                    int x, int y, int w, int h);
  91. extern void layout (struct display *);
  92. extern int pr_display_cell (struct display *, CELLREF, CELLREF, CELL *);
  93. #else
  94. extern void free_display ();
  95. extern void build_display ();
  96. extern void build_unscaled_display ();
  97. extern void display_test_cmd ();
  98. extern struct cell_display *cell_display_of ();
  99. extern void display_range ();
  100. extern void record_display_damage ();
  101. extern void layout ();
  102. extern int pr_display_cell ();
  103. #endif
  104.  
  105. #define display_width(DPY) \
  106.      ((DPY)->colx[(DPY)->range.hc - (DPY)->range.lc] \
  107.       + (DPY)->widths[(DPY)->range.hc - (DPY)->range.lc])
  108. #define display_height(DPY) \
  109.      ((DPY)->rowy[(DPY)->range.hr - (DPY)->range.lr] \
  110.       + (DPY)->heights[(DPY)->range.hr - (DPY)->range.lr])
  111. #define dpy_cols(DPY) ((DPY)->range.hc - (DPY)->range.lc)
  112. #define dpy_aref(DPY,R,C) \
  113.    ((DPY)->cells + (((R) - (DPY)->range.lr) * dpy_cols(DPY)) \
  114.     + ((C) - (DPY)->range.lc))
  115. #endif
  116.